package com.zcy.model;
//地图类
import com.zcy.utils.MapUtils;
import java.util.ArrayList;
import java.util.List;

public class Map {
    //设置层高
    private Integer floorHeight;
    private List<Layer> list = new ArrayList<>();

    public Integer getFloorHeight() {
        return floorHeight;
    }

    public void setFloorHeight(Integer floorHeight) {
        this.floorHeight = floorHeight;
    }

    public List<Layer> getList() {
        return list;
    }

    public void setList(List<Layer> list) {
        this.list = list;
    }

//    public void compareAll(){
//        for (int i = 0;i < list.size();i++){
//            Layer layer = list.get(i);
//            //获取格子
//            Cell[][] cells = layer.getCells();
//            for (int row = 0;row < cells.length;row++){
//                for (int col = 0;col < cells[row].length;col++){
//                    Cell cell = cells[row][col];
//                    //判断格子对象是否有牌
//                    if (cell.getState() == 1){
//                        Brand brand = cell.getBrand();
//                        boolean resutlt = MapUtils.compare(brand,layer);
//                        brand.setGray(resutlt);
//                    }
//                }
//            }
//        }
//    }


    public void compareAll(){
        for (int i=1;i<list.size();i++){
            Layer layer = list.get(i);
            Cell[][] cells = layer.getCells();
            for (int row = 0; row < cells.length; row++) {
                for (int col = 0; col < cells[row].length; col++) {
                    Cell cell = cells[row][col];
//需要判断有牌
                    if (cell.getState()==1){
                        Brand brand = cell.getBrand();
                        boolean result = MapUtils.compare(brand,
                                layer.getParent());
                        brand.setGray(result);
                    }
                }
            }
        }
    }
}
